/**
 * Definition for singly-linked list.
 * function ListNode(val, next) {
 *     this.val = (val===undefined ? 0 : val)
 *     this.next = (next===undefined ? null : next)
 * }
 */
/**
 * @param {ListNode} l1
 * @param {ListNode} l2
 * @return {ListNode}
 */
var addTwoNumbers = function(l1, l2) {

  const num1 = (Number)(l1.reverse().join(''))
  const num2 = (Number)(l2.reverse().join(''))

  const result= (String)(num1+num2)

  const resultArray = result.split("").reverse()

  return resultArray
    
};

var line1 = [2,4,3]

var line2 = [5,6,4]

const res = addTwoNumbers(line1,line2)


console.log(res)